home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1988 / Feb 88 / re Cloning 2⁄8 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.7 KB  |  41 lines  |  [TEXT/GEOL]

  1. Item    2734525                         8-Feb-88        11:43
  2.  
  3. From:   ROSENSTEIN1                     Rosenstein, Larry
  4.  
  5. To:     D1002                           PEMD Ed Group, Dev, E Rosenberg
  6.  
  7. cc:     MACAPP$                         MacApp Interest List
  8.  
  9. Sub:    re Cloning
  10.  
  11. The short answer is that cloning a TView doesn't work.
  12.  
  13. TObject.Clone simply duplicates the storage associated with an object.  If you
  14. have a complex object with references to other objects as fields, then the
  15. object might have to override Clone and deal with those references.  In
  16. general, we did not do this for the MacApp classes, because the internal
  17. structure of the objects is so complex.
  18.  
  19. In the case of TView, there is a relationship between the view object and the
  20. frame that displays it.  The frame object contains a reference to the view, and
  21. is the object responsible for drawing the view.  Simply cloning the view won't
  22. clone the frame, so there is no call to TView.Draw.
  23.  
  24. Even if you create a separate frame and tell the view clone to display in that
  25. frame, there are other things that won't be correct.  For example, the document
  26. object contains a list of all the view.
  27.  
  28. Clone is not as much of a time saver as you might think.  For example, the
  29. number of methods implemented in a class has no impact on the time it takes to
  30. create an object of that class.  All the methods as a group are referenced with
  31. one pointer.  The only time you save is in the initialization method, which is
  32. not really significant.
  33.  
  34. With some work, I suppose we could have made TView.Clone work.  However, we did
  35. not expect people to clone views as a substitute for creating them in the usual
  36. way (New(...); IView(...)).
  37.  
  38. Larry
  39.  
  40.  
  41.